<template>
	<view>
		<view class="header flex">
			<image :src="imgurl+'success.png'"></image>
		</view>
		<view class="main-title">发布成功</view>
		<view class="mian-text">赶快分享调查,回收答卷吧~</view>
		<button class="buttoncss" @tap="share">分享调查</button>
		<button class="buttoncss other" @tap="backIndex">返回问卷列表</button>
	</view>
</template>

<script>
	import app from "../../App.vue"
	export default {
		data() {
			return {
				imgurl: "",
				wenid: '',
				wxpid: ''
			};
		},
		methods: {
			share() {
				uni.navigateTo({
					url: '../share/share?wenid=' + this.wenid + '&wxpid=' + this.wxpid
				})
			},
			backIndex() {
				uni.reLaunch({
					url: '../index/index'
				})
			}
		},
		onShareAppMessage(options) {
			let shareObj = {
				success: (res) => {
					if (res.errMsg == 'shareAppMessage:ok') {
						uni.showToast({
							title: '分享成功',
							icon: 'success',
							duration: 1500
						})
					}
				},
				fail: () => {
					if (res.errMsg == 'shareAppMessage:fail cancel') {
						uni.showToast({
							title: '取消分享',
							icon: 'none',
							duration: 2000
						})
					} else if (res.errMsg == 'shareAppMessage:fail') {
						// 转发失败，其中 detail message 为详细失败信息
					}
				},
				complete: () => {
					// 转发结束之后的回调（转发成不成功都会执行）
				}
			}
		},
		onLoad(options) {
			var that = this;
			that.imgurl = app.globalData.imgurl;
			this.wenid = options.wenid
			if(options.wxpid){
				this.wxpid = options.wxpid
			}
		},
	}
</script>

<style lang="scss">
	.header {
		justify-content: center;
		margin: 50rpx 0;

		image {
			width: 200rpx;
			height: 200rpx;
		}
	}

	.main-title {
		color: #666;
		font-size: 36rpx;
		text-align: center;
		margin: 50rpx 0 30rpx 0;
	}

	.mian-text {
		color: #999;
		font-size: 26rpx;
		text-align: center;
		margin-bottom: 30rpx;
	}

	.buttoncss {
		width: 690rpx;
		height: 100rpx;
		line-height: 100rpx;
		margin: 30rpx auto;
		border-radius: 50rpx;
		color: #fff;
		background: #209FFC;
	}

	.other {
		background: #fff;
		color: #666;
		border: 1rpx solid #DFDFDF;
	}
</style>
